#include<iostream>
#include<thread>
#include<future>
#include<memory>
int Add(int num1,int num2)
{
    return num1+num2;
}

int  main()
{
    auto packg=std::make_shared<std::packaged_task<int(int,int)>>(Add);

    std::future<int> fu=packg->get_future();

    std::thread thr([packg](){
        (*packg)(11,22);
    });

    int sum=fu.get();
    std::cout<<sum<<std::endl;
    thr.join();
    return 0;
}